<template>
  <view>
    <user-info-card
        v-if="person.type==='userAccount'"
    :userInfo="userInfo"
    ></user-info-card>
  </view>
</template>

<script>
export default {
  props:{
    person: {
      type: Object,
      default: {
        type: "",
        value: ""
      }
    },
  },
  data() {
    return {
      userInfo: {
      }
    }
  },
  watch: {
    person: {
      async handler(val) {
        if(!val.value) {
          return;
        }

        await this.$kt.userAccount.getById(this.person.value).then(res => {
          this.userInfo = res;
        }).catch(err => {
        });
        await this.$kt.userAccount.requestById(this.person.value).then(res => {
          this.userInfo = res;
        }).catch(err => {
        });
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
  },


}
</script>

<style lang="scss" scoped>
</style>
